package com.wzt.lianfirecontrol.fragment;

import android.app.Dialog;
import android.nfc.NfcAdapter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnTimeSelectChangeListener;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.TimePickerView;
import com.google.gson.Gson;
import com.wzt.lianfirecontrol.App;
import com.wzt.lianfirecontrol.R;
import com.wzt.lianfirecontrol.activity.BaseActivity;
import com.wzt.lianfirecontrol.activity.LoginActivity;
import com.wzt.lianfirecontrol.activity.NfcDeviceActivity;
import com.wzt.lianfirecontrol.activity.ShowFragActivity;
import com.wzt.lianfirecontrol.adapter.BaseRecyclerAdapter;
import com.wzt.lianfirecontrol.adapter.baojinfuhe.BaoJingFuHeAdapter;
import com.wzt.lianfirecontrol.adapter.home.system.baojing.SysBaoJingDeviceAdapter;
import com.wzt.lianfirecontrol.adapter.home.system.jiance.SysJianCeBuildListAdapter;
import com.wzt.lianfirecontrol.adapter.jiankong.JianKongBuildListAdapter;
import com.wzt.lianfirecontrol.adapter.jiankong.JianKongDeviceListAdapter;
import com.wzt.lianfirecontrol.adapter.jinjiweixiu.JinJiListAdapter;
import com.wzt.lianfirecontrol.adapter.message.MessageListAdapter;
import com.wzt.lianfirecontrol.adapter.xiaokongshi.XksProblemAdapter;
import com.wzt.lianfirecontrol.adapter.xuncha.XunChaItemAdapter;
import com.wzt.lianfirecontrol.adapter.xuncha.XunChaListAdapter;
import com.wzt.lianfirecontrol.adapter.xuncha.XunChaQuestionAdapter;
import com.wzt.lianfirecontrol.adapter.xuncha.devicexuncha.DeviceListAdapter;
import com.wzt.lianfirecontrol.adapter.xuncha.devicexuncha.XunChaDeviceQuestionAdapter;
import com.wzt.lianfirecontrol.adapter.yighuan.YingHuanListAdapter;
import com.wzt.lianfirecontrol.adapter.yuyueweibao.ChooseWeiBaoPersonAdapter;
import com.wzt.lianfirecontrol.adapter.yuyueweibao.YuYueListAdapter;
import com.wzt.lianfirecontrol.bean.BaseModel;
import com.wzt.lianfirecontrol.bean.ConstData;
import com.wzt.lianfirecontrol.bean.MessageEvent;
import com.wzt.lianfirecontrol.bean.recode.AppVersionModel;
import com.wzt.lianfirecontrol.bean.recode.BannerModel;
import com.wzt.lianfirecontrol.bean.recode.ListModel;
import com.wzt.lianfirecontrol.bean.recode.function.baojingfuhe.BaoJingCheckModel;
import com.wzt.lianfirecontrol.bean.recode.function.jinjiweixiu.JingJiWeiXiuModel;
import com.wzt.lianfirecontrol.bean.recode.function.xiaokongshi.XiaoKongShiModel;
import com.wzt.lianfirecontrol.bean.recode.function.xiaokongshi.XksRecordModel;
import com.wzt.lianfirecontrol.bean.recode.function.xiaokongshi.XksRecordProblemModel;
import com.wzt.lianfirecontrol.bean.recode.function.xuncha.XunChaBuildingModel;
import com.wzt.lianfirecontrol.bean.recode.function.xuncha.XunChaItemModel;
import com.wzt.lianfirecontrol.bean.recode.function.xuncha.XunChaPlanModel;
import com.wzt.lianfirecontrol.bean.recode.function.xuncha.XunChaQuestionModel;
import com.wzt.lianfirecontrol.bean.recode.function.xuncha.devicexuncha.XunChaDeviceFloorModel;
import com.wzt.lianfirecontrol.bean.recode.function.xuncha.devicexuncha.XunChaDeviceListModel;
import com.wzt.lianfirecontrol.bean.recode.function.xuncha.devicexuncha.XunChaDeviceQuestionModel;
import com.wzt.lianfirecontrol.bean.recode.function.yinhuan.YingHuanModel;
import com.wzt.lianfirecontrol.bean.recode.function.yuyueweibao.WeiBaoPersonModel;
import com.wzt.lianfirecontrol.bean.recode.function.yuyueweibao.YuYueModel;
import com.wzt.lianfirecontrol.bean.recode.home.jiankong.JianKongBuildingModel;
import com.wzt.lianfirecontrol.bean.recode.home.jiankong.JianKongDeviceModel;
import com.wzt.lianfirecontrol.bean.recode.home.jiankong.JianKongFloorModel;
import com.wzt.lianfirecontrol.bean.recode.home.system.SysDeviceModel;
import com.wzt.lianfirecontrol.bean.recode.home.system.baojing.DetailErrorModel;
import com.wzt.lianfirecontrol.bean.recode.home.system.baojing.DeviceChartModel;
import com.wzt.lianfirecontrol.bean.recode.home.system.baojing.SysBaoJingDeviceDetailModel;
import com.wzt.lianfirecontrol.bean.recode.home.system.jiance.SystemBuildModel;
import com.wzt.lianfirecontrol.bean.recode.message.MessageListModel;
import com.wzt.lianfirecontrol.bean.recode.user.CompanyModel;
import com.wzt.lianfirecontrol.bean.recode.user.RoleConstant;
import com.wzt.lianfirecontrol.bean.recode.user.UserInfoModel;
import com.wzt.lianfirecontrol.http.HttpHelper;
import com.wzt.lianfirecontrol.http.json.ParseJsonData;
import com.wzt.lianfirecontrol.http.Url;
import com.wzt.lianfirecontrol.utils.DialogUtils;
import com.wzt.lianfirecontrol.utils.JSONUtil;
import com.wzt.lianfirecontrol.utils.PreferencesUtils;
import com.wzt.lianfirecontrol.utils.SpUtils;
import com.wzt.lianfirecontrol.utils.StringUtils;
import com.wzt.lianfirecontrol.utils.ToastUtils;
import com.wzt.lianfirecontrol.utils.Utils;
import com.wzt.lianfirecontrol.view.InitView;
import com.wzt.lianfirecontrol.view.SuperSwipeRefreshLayout;

import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

public class InfoListFragment extends BaseFragment implements SuperSwipeRefreshLayout.OnSwipeRefreshListener, MessageListAdapter.MessageListCallBack {

    private BaseActivity activity;
    private Bundle bundle;
    private static final int GET_VIDEO_LIST_WHAT = 3;
    private View itemContentView;

    /**
     * 日期选择
     */
    private LinearLayout ll_calender_select;
    private TextView tv_start_time;
    private ImageView iv_start_expand;
    private TextView tv_stop_time;
    private ImageView iv_stop_expand;

    private SuperSwipeRefreshLayout swipe_container;
    private RecyclerView rlv_info_list;
    public BaseRecyclerAdapter baseRecyclerAdapter;
    private LinearLayoutManager llm_info_list;
    /**
     * 列表展示类型
     */
    public String showType = "";
    /**
     * 列表底部数据加载状态
     */
    private View footerView;
    private LinearLayout ll_recycler_footer;
    private RelativeLayout rl_no_more_data;

    private Button bt_add_unusual;
    private ImageView iv_add_img;

    private RelativeLayout rl_complete_bottom;
    private LinearLayout ll_building_num;
    private TextView tv_building_num;
    private Button bt_complete;

    private View include_no_data;
    private View include_no_net;
    private View include_progress_bar;

    private static final int INFO_LIST_REQUEST_WHAT = 0;
    private int currentPage = 1;
    private boolean isNoMoreData = false;
    private boolean isListLoadOver = true;
    private int lastVisibleItem;

    private Dialog completeAllDialog;
    private static final int COMPLETE_ALL_WHAT = 1;


    private TimePickerView pvStartTime;
    private TimePickerView pvStopTime;

    private boolean isHistroyList = false;
    private boolean isSelectTitle = false;
    private boolean isComplete = false;

    private String status;// 消控室状态 // 0：待值班；1:值班中；2：未值班；3：待交接；4：已完成
    private boolean isFirstLoad = true;
    private boolean isPingBi = false;// 是否是屏蔽历史
    private boolean isDeviceComplete = false;// 是否是设备巡查完成界面 1是已完成

    private ArrayList<XunChaBuildingModel> buildModelList;
    private XunChaPlanModel xunChaPlanModel;

    private Dialog msgDeleDialog;
    private static final int DELETE_MSG_WHAT = 2;
    public LinearLayout ll_message_bottom;
    private Button bt_message_cancel;
    private Button bt_message_delete;

    private YuYueModel yuYueModel;
    private static final int POST_PERSON_WHAT = 3;
    private XiaoKongShiModel xiaoKongShiModel;

    private Dialog openNfcDialog;

    private String equSysId;// 首页系统进楼栋列表传参

    private JianKongFloorModel jianKongFloorModel;// 首页视频监控设备列表
    private List<JianKongDeviceModel> jianKongDeviceModels;

    private XunChaDeviceFloorModel xunChaDeviceFloorModel;
    private LinkedList<SysDeviceModel> mSysBaoJingDeviceModels;
    private LinkedList<SysDeviceModel> mMSysBaoJingDeviceModels;


    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        if (null == itemContentView) {
            bundle = getArguments();
            if (null != bundle) {
                isHistroyList = bundle.getBoolean("isHistory", false);
                isSelectTitle = bundle.getBoolean("isSelectTitle", false);
                isComplete = bundle.getBoolean("isComplete", false);
                status = bundle.getString("status", "1");
                isPingBi = bundle.getBoolean("isPingBi", false);
                yuYueModel = (YuYueModel) bundle.getSerializable("yuyueModel");
                buildModelList = (ArrayList<XunChaBuildingModel>) bundle.getSerializable("buildModelList");
                xunChaPlanModel = (XunChaPlanModel) bundle.getSerializable("xunChaPlanModel");
                xiaoKongShiModel = (XiaoKongShiModel) bundle.getSerializable("XiaoKongShiModel");
                isDeviceComplete = "1".equals(bundle.getString(ConstData.ISDEVICECOMPLETE, "0"));
                jianKongFloorModel = (JianKongFloorModel) bundle.getSerializable("jianKongFloorModel");
                xunChaDeviceFloorModel = (XunChaDeviceFloorModel) bundle.getSerializable("XunChaDeviceFloorModel");
                jianKongDeviceModels = (List<JianKongDeviceModel>) bundle.getSerializable("JianKongDeviceModels");

                if (bundle.containsKey(ConstData.SHOWTYPPE)) {
                    showType = bundle.getString(ConstData.SHOWTYPPE);
                }
                HashMap<String, String> url_params = (HashMap<String, String>) bundle.getSerializable(ConstData.ACTIONPARAMS);
                if (null != url_params) {
                    if (url_params.containsKey(ConstData.SHOWTYPPE)) {
                        showType = url_params.get(ConstData.SHOWTYPPE);
                        url_params.remove(ConstData.SHOWTYPPE);
                    }
                    if (url_params.containsKey("equSysId")) {
                        equSysId = url_params.get("equSysId");
                    }
                }
            }
            activity = getMyActivity();
            itemContentView = inflater.inflate(R.layout.f_info_list, container, false);
            initView();
            initHttpHelper();
        }
        if (itemContentView.getParent() != null) {
            ((ViewGroup) itemContentView.getParent()).removeView(itemContentView);
        }
        //  EventBus.getDefault().register(this);
        return itemContentView;
    }

    private void initView() {
        initSelectCalender();

        swipe_container = itemContentView.findViewById(R.id.swipe_container);
        InitView.instance().initSuperSwipeLayout(swipe_container);
        swipe_container.setOnSwipeRefreshListener(this);
        swipe_container.setHeaderViewBackgroundColor(activity.getResources().getColor(R.color.divider_line_color));

        initListView();

        bt_add_unusual = itemContentView.findViewById(R.id.bt_add_unusual);
        if (ConstData.UNUSUALLIST.equals(showType) && ("1".equals(status) || "2".equals(status) || "4".equals(status))) {
            bt_add_unusual.setVisibility(View.VISIBLE);
            bt_add_unusual.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (!UserInfoModel.isSelfCompany(activity)) {
                    //    ToastUtils.showToast(activity, ConstData.ERROR_COMPANY_MSG);
                        return;
                    }
                    UserInfoModel userInfoModel = UserInfoModel.getUserInfo(activity);
                    if (userInfoModel.getRoleAlias().contains(RoleConstant.ROLE_DUTY)) {
                        activity.setClickAction(ConstData.SHOWFRAG, ConstData.ADDUNUSUAL,
                                "添加问题", null, bundle);
                    } else {
                        ToastUtils.showToast(activity, "非值班员用户");
                    }
                }
            });
        } else if (ConstData.WEIBAOPERSON.equals(showType)) {
            bt_add_unusual.setVisibility(View.VISIBLE);
            bt_add_unusual.setText("确认指派");
            bt_add_unusual.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // 指派
                    if (StringUtils.isEmpty(((ChooseWeiBaoPersonAdapter) baseRecyclerAdapter).getUserId())) {
                        ToastUtils.showToast(activity, "未指定维保人员");
                        return;
                    }
                    initPostPersonHttpHelper();
                }
            });
        }
        // 添加记录按钮
        iv_add_img = itemContentView.findViewById(R.id.iv_add_img);
        if (ConstData.YUYUE.equals(showType) || ConstData.JINGJI.equals(showType) || ConstData.YINGHUAN.equals(showType)) {
            List<String> alias = UserInfoModel.getUserInfo(App.context).getRoleAlias();

//            if (alias.contains(RoleConstant.ROLE_ORG_MANAGER)) {
//                iv_add_img.setVisibility(View.GONE);
//            } else {
//                iv_add_img.setVisibility(View.VISIBLE);
//
//            }
            iv_add_img.setVisibility(View.VISIBLE);
            iv_add_img.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (!UserInfoModel.isSelfCompany(activity)) {
                 //       ToastUtils.showToast(activity, ConstData.ERROR_COMPANY_MSG);
                        return;
                    }
                    switch (showType) {
                        case ConstData.YUYUE:
                            activity.setClickAction(ConstData.SHOWFRAG, ConstData.ADDYUYUE, "添加预约保单", null);
                            break;
                        case ConstData.JINGJI:
                            activity.setClickAction(ConstData.SHOWFRAG, ConstData.ADDJINJI, "添加紧急维修单", null);
                            break;
                        case ConstData.YINGHUAN:
                            activity.setClickAction(ConstData.SHOWFRAG, ConstData.ADDYINGHUAN, "添加隐患整改单", null);
                            break;
                    }
                }
            });
            if (ConstData.YUYUE.equals(showType)) {
                UserInfoModel userInfoModel = UserInfoModel.getUserInfo(activity);
                if (userInfoModel.getRoleAlias().contains(RoleConstant.ROLE_REPAIR_MANAGER)
                        || userInfoModel.getRoleAlias().contains(RoleConstant.ROLE_REPAIR)||alias.contains(RoleConstant.ROLE_ORG_MANAGER)) {
                    iv_add_img.setVisibility(View.GONE);
                }
            }
        }

        //设置nfc巡查动作
        if (ConstData.DEVICELIST.equals(showType) && !isDeviceComplete && activity instanceof ShowFragActivity) {
            ((ShowFragActivity) activity).setNfcCheckAction(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(activity);
                    if (nfcAdapter == null) {
                        ToastUtils.showToast(activity, "此设备不支持nfc功能！");
                        return;
                    }
                    if (!nfcAdapter.isEnabled()) {
                        openNfcDialog = DialogUtils.createSureAndCancelDialog(activity, "此功能需打开NFC",
                                "取消", "打开", new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        openNfcDialog.dismiss();
                                    }
                                }, new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        openNfcDialog.dismiss();
                                        // 打开NFC
                                        Bundle skipBundle = new Bundle();
                                        if (null != bundle) {
                                            skipBundle.putSerializable(ConstData.ACTIONPARAMS, bundle.getSerializable(ConstData.ACTIONPARAMS));
                                        }
                                        ((ShowFragActivity) activity).skipToNfcBundle = skipBundle;
                                        Utils.openNfc(activity, ((ShowFragActivity) activity).OPEN_NFC_WHAT);
                                    }
                                });
                        openNfcDialog.show();
                    } else {
                        skipToNfcPage();
                    }
                }
            });
        }

        initCompleteBottomView();

        include_no_data = itemContentView.findViewById(R.id.include_no_data);
        include_progress_bar = itemContentView.findViewById(R.id.include_progress_bar);
        InitView.instance().initProgressBar(activity, include_progress_bar);
        include_no_net = itemContentView.findViewById(R.id.include_no_net);
        include_no_net.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                updateData();
            }
        });

        if (activity instanceof ShowFragActivity && ConstData.HOME_BAOJING_DEVICE_LIST.equals(showType) && !isHistroyList && !isSelectTitle) {
            BannerModel bannerModel = new BannerModel();
            bannerModel.setTitle("历史");
            bannerModel.setActionTitle(((ShowFragActivity) activity).tv_title.getText().toString() + "历史");
            bannerModel.setActionType(ConstData.SHOWFRAG);
            bannerModel.setActionValue(ConstData.INFOLIST);
            Bundle skipBundle = new Bundle();
            HashMap<String, String> url_params = null;
            if (bundle != null && bundle.containsKey(ConstData.ACTIONPARAMS)) {
                url_params = (HashMap<String, String>) bundle.getSerializable(ConstData.ACTIONPARAMS);
            }
            if (null == url_params) {
                url_params = new HashMap<>();
            }
            HashMap<String, String> hashMap = new HashMap<>();
            hashMap.put("runStatus", url_params.get("runStatus"));
            bannerModel.setActionParams(hashMap);
            skipBundle.putBoolean("isHistory", true);
            skipBundle.putString(ConstData.SHOWTYPPE, ConstData.HOME_BAOJING_DEVICE_LIST);
            ((ShowFragActivity) activity).setTextEtAction(bannerModel, skipBundle);
        }

        ll_message_bottom = itemContentView.findViewById(R.id.ll_message_bottom);
        bt_message_cancel = itemContentView.findViewById(R.id.bt_message_cancel);
        bt_message_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ll_message_bottom.setVisibility(View.GONE);
                ((MessageListAdapter) baseRecyclerAdapter).setChooseDelete(false);
            }
        });
        bt_message_delete = itemContentView.findViewById(R.id.bt_message_delete);
        bt_message_delete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                StringBuilder stringBuilder = new StringBuilder();
                for (int i = 0; i < ((MessageListAdapter) baseRecyclerAdapter).getmDatas().size(); i++) {
                    MessageListModel messageListModel = ((MessageListAdapter) baseRecyclerAdapter).getmDatas().get(i);
                    if (messageListModel.isSelected()) {
                        if (StringUtils.isEmpty(stringBuilder.toString())) {
                            stringBuilder.append(messageListModel.getId());
                        } else {
                            stringBuilder.append("," + messageListModel.getId());
                        }
                    }
                }
                if (StringUtils.isEmpty(stringBuilder.toString())) {
                    ToastUtils.showToast(activity, "未选中消息");
                    return;
                }
                msgDeleDialog = DialogUtils.createSureAndCancelDialog(activity, "是否删除选中消息", "取消", "确认", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        DialogUtils.closeDialog(msgDeleDialog);
                    }
                }, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        ll_message_bottom.setVisibility(View.GONE);
                        ((MessageListAdapter) baseRecyclerAdapter).setChooseDelete(false);
                        DialogUtils.closeDialog(msgDeleDialog);
                        initMsgDeleteHttpHelper(stringBuilder.toString());
                    }
                });
                DialogUtils.showDialog(msgDeleDialog);
            }
        });
    }

    private void initCompleteBottomView() {
        rl_complete_bottom = itemContentView.findViewById(R.id.rl_complete_bottom);
        ll_building_num = itemContentView.findViewById(R.id.ll_building_num);
        tv_building_num = itemContentView.findViewById(R.id.tv_building_num);
        bt_complete = itemContentView.findViewById(R.id.bt_complete);
        bt_complete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!UserInfoModel.isSelfCompany(activity)) {
             //       ToastUtils.showToast(activity, ConstData.ERROR_COMPANY_MSG);
                    return;
                }
                UserInfoModel userInfoModel = UserInfoModel.getUserInfo(activity);
                if (!userInfoModel.getRoleAlias().contains(RoleConstant.ROLE_INSPECTION)) {
                    ToastUtils.showToast(activity, "无权限");
                    return;
                }

                String msg = "是否全部完成";
                if (ConstData.DEVICELIST.equals(showType)) {
                    msg = "是否全部完成本层设备(NFC/蓝牙以外)的巡查";
                }
                completeAllDialog = DialogUtils.createSureAndCancelDialog(activity, msg, "取消", "确认",
                        new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                // 取消
                                DialogUtils.closeDialog(completeAllDialog);
                            }
                        }, new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                DialogUtils.closeDialog(completeAllDialog);
                                initCompletHttpHelper();
                            }
                        });
                DialogUtils.showDialog(completeAllDialog);
            }
        });

        if (ConstData.XUNCHAITEM.equals(showType) || ConstData.DEVICELIST.equals(showType)) {
            if (isComplete || isDeviceComplete) {
                rl_complete_bottom.setVisibility(View.GONE);
            } else {
                if (null != buildModelList && buildModelList.size() > 0) {
                    ll_building_num.setVisibility(View.VISIBLE);
                    tv_building_num.setText("共" + Utils.convert(buildModelList.size()) + "个楼栋");
                }
                rl_complete_bottom.setVisibility(View.VISIBLE);
            }
        } else {
            rl_complete_bottom.setVisibility(View.GONE);
        }
    }

    private void initSelectCalender() {
        ll_calender_select = itemContentView.findViewById(R.id.ll_calender_select);
        tv_start_time = itemContentView.findViewById(R.id.tv_start_time);
        iv_start_expand = itemContentView.findViewById(R.id.iv_start_expand);
        tv_stop_time = itemContentView.findViewById(R.id.tv_stop_time);
        iv_stop_expand = itemContentView.findViewById(R.id.iv_stop_expand);
        if (isHistroyList) {
            ll_calender_select.setVisibility(View.VISIBLE);
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD_HH_MM_SS);
            Date date = new Date();
            tv_start_time.setText(simpleDateFormat.format(new Date(date.getTime() - 7 * 24 * 60 * 60 * 1000)));
            tv_stop_time.setText(simpleDateFormat.format(date));
            tv_start_time.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (!isHistroyList) {
                        return;
                    }
                    try {
                        if (null == pvStartTime) {
                            initStartTimePicker();
                        }
                        Calendar calendar = Calendar.getInstance();
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD_HH_MM_SS);
                        Date date = simpleDateFormat.parse(tv_start_time.getText().toString());
                        calendar.setTime(date);
                        pvStartTime.show();
                    } catch (Exception e) {
                    }
                }
            });
            tv_stop_time.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (!isHistroyList) {
                        return;
                    }
                    try {
                        if (null == pvStopTime) {
                            initStopTimePicker();
                        }
                        Calendar calendar = Calendar.getInstance();
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD_HH_MM_SS);
                        Date date = simpleDateFormat.parse(tv_stop_time.getText().toString());
                        calendar.setTime(date);
                        pvStopTime.show();
                    } catch (Exception e) {
                    }
                }
            });

        } else {
            ll_calender_select.setVisibility(View.GONE);
        }

    }

    private void initListView() {
        rlv_info_list = itemContentView.findViewById(R.id.rlv_info_list);
        llm_info_list = new LinearLayoutManager(activity);
        llm_info_list.setOrientation(LinearLayoutManager.VERTICAL);
        rlv_info_list.setLayoutManager(llm_info_list);

        if (showType.equals(ConstData.WEIBAOPERSON)) {
            rlv_info_list.setPadding(0, 0, 0, 0);
        }

        initListAdapter();

        rlv_info_list.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                if (newState == RecyclerView.SCROLL_STATE_IDLE
                        && lastVisibleItem + 1 == baseRecyclerAdapter.getItemCount()) {
                    bottomLoadMore();
                }
            }

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                lastVisibleItem = llm_info_list.findLastVisibleItemPosition();
            }
        });
    }

    private void initListAdapter() {
        switch (showType) {
            case ConstData.XUNCHA:
                baseRecyclerAdapter = new XunChaListAdapter(activity);
                break;
            case ConstData.XUNCHAITEM:
                baseRecyclerAdapter = new XunChaItemAdapter(activity);
                break;
            case ConstData.XUNCHAQUESTION:
                baseRecyclerAdapter = new XunChaQuestionAdapter(activity);
                break;
            case ConstData.XUNCHADEVICEQUESTION:
                baseRecyclerAdapter = new XunChaDeviceQuestionAdapter(activity);
                break;
            case ConstData.MESSAGELIST:
                baseRecyclerAdapter = new MessageListAdapter(activity, this);
                ((MessageListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(!tv_start_time.isShown());
                break;
            case ConstData.LOCATIONLIST:
                baseRecyclerAdapter = new SysJianCeBuildListAdapter(activity);
                ((SysJianCeBuildListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.JIANKONGBUILDLIST: //shi
                baseRecyclerAdapter = new JianKongBuildListAdapter(activity);
                ((JianKongBuildListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.XKSVIDEOLIST:
            case ConstData.DEVICEVIDEOLIST:
            case ConstData.JIANKONGDEVICELIST:
                baseRecyclerAdapter = new JianKongDeviceListAdapter(activity);
                ((JianKongDeviceListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.YUYUE:
                baseRecyclerAdapter = new YuYueListAdapter(activity);
                ((YuYueListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.JINGJI:
                baseRecyclerAdapter = new JinJiListAdapter(activity);
                ((JinJiListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.YINGHUAN:
                baseRecyclerAdapter = new YingHuanListAdapter(activity);
                ((YingHuanListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.BAOJING: // 报警复核
                baseRecyclerAdapter = new BaoJingFuHeAdapter(activity);
                ((BaoJingFuHeAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.UNUSUALLIST:
                baseRecyclerAdapter = new XksProblemAdapter(activity);
                ((XksProblemAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.DEVICELIST:
                baseRecyclerAdapter = new DeviceListAdapter(activity);
                ((DeviceListAdapter) baseRecyclerAdapter).setNeedSetTopMargin(true);
                break;
            case ConstData.WEIBAOPERSON:
                baseRecyclerAdapter = new ChooseWeiBaoPersonAdapter(activity);
                ((ChooseWeiBaoPersonAdapter) baseRecyclerAdapter).setUserId(yuYueModel.getUserId());
                break;
            case ConstData.HOME_BAOJING_DEVICE_LIST: // 故障列表
            default:
                baseRecyclerAdapter = new SysBaoJingDeviceAdapter(activity);
                ((SysBaoJingDeviceAdapter) baseRecyclerAdapter).setNeedSetTopMargin(ll_calender_select.getVisibility() == View.GONE);
                break;
        }
        rlv_info_list.setAdapter(baseRecyclerAdapter);
        initFooterView();

        baseRecyclerAdapter.setOnItemClickListener(new BaseRecyclerAdapter.OnItemClickListener<BaseModel>() {
            @Override
            public void onItemClick(View v, int position, BaseModel data) {
                if (v.getId() == R.id.iv_videos) {
                 //   ToastUtils.showToast(App.context, "shi");
                    String equVideoIds = mMSysBaoJingDeviceModels.get(position).getEquVideoIds();
                    initVideoDeviceListHttpHelper(equVideoIds);

                }else {

                    if (ConstData.YUYUE.equals(showType)) { // 预约
                        // 预约维保列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.YUYUEDETAIL);
                        bannerModel.setActionTitle("详情");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.JINGJI.equals(showType)) {
                        // 紧急维修单列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.JINJIDETAIL);
                        bannerModel.setActionTitle("详情");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.YINGHUAN.equals(showType)) {
                        // 隐患整改列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.YINGHUANDETAIL);
                        bannerModel.setActionTitle("详情");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.BAOJING.equals(showType)) {
                        // 报警复核列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.FUHEDETAIL);
                        bannerModel.setActionTitle("详情");
                        Log.e("tes",data.toString());
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.UNUSUALLIST.equals(showType)) {
                        // 问题列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.UNUSUALDETAIL);
                        bannerModel.setActionTitle("问题详情");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.XUNCHA.equals(showType)) {
                        // 防火巡查检查列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        if ("2".equals(((XunChaPlanModel) data).getStatus())) {
                            // 已完成
                            bannerModel.setActionValue(ConstData.XUNCHACOMPLETE);
                            bannerModel.setActionTitle("巡查详情");

                        } else {

                            bannerModel.setActionValue(ConstData.STARTXUNCHA);
                            bannerModel.setActionTitle(InfoListFragment.this.bundle.getString("title"));

                        }
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.XUNCHAITEM.equals(showType)) {
                        // 检查项列表点击
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionTitle("问题详情");
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.ADDXUNCHAQES);
                        Bundle bundle1 = new Bundle();
                        bundle1.putString("ids", bundle.getString("ids"));
                        bundle1.putString("floorIds", bundle.getString("floorIds"));
                        bundle1.putSerializable("XunChaItemModel", data);
                        bundle1.putSerializable("buildModelList", buildModelList);
                        bundle1.putSerializable("xunChaPlanModel", xunChaPlanModel);
                        activity.setClickAction(bannerModel, bundle1);

                    } else if (ConstData.XUNCHAQUESTION.equals(showType)) {

                        // 防火巡检查问题列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.XUNCHADETAIL);
                        bannerModel.setActionTitle("问题详情");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.XUNCHADEVICEQUESTION.equals(showType)) {

                        // 设备巡检查问题列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.XUNCHADEVICEDETAIL);
                        bannerModel.setActionTitle("问题详情");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.LOCATIONLIST.equals(showType)) {
                        // 系统楼栋点击列表
                        SystemBuildModel buildModel = (SystemBuildModel) data;
                        buildModel.setEquSysId(equSysId);
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("data", buildModel);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.WEB_CAD);
                        bannerModel.setActionValue("");
                        bannerModel.setActionTitle(buildModel.getBuildingName());
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.JIANKONGBUILDLIST.equals(showType)) {

                        // 系统楼栋点击列表
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("jianKongBuilding", data);
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.BARFLOOR);
                        bannerModel.setActionTitle("监控设备");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (ConstData.JIANKONGDEVICELIST.equals(showType)  // 监控列表
                            || ConstData.XKSVIDEOLIST.equals(showType)    //消控室监控设备列表
                            || ConstData.DEVICEVIDEOLIST.equals(showType)) {  // 设备监控设备列表

                        JianKongDeviceModel data1 = (JianKongDeviceModel) data;


                        Bundle bundle = new Bundle();
                        bundle.putSerializable("JianKongDeviceModel", data);
                        activity.setClickAction(ConstData.VIDEO, ((JianKongDeviceModel) data).getAccessMode(), "监控设备", null, bundle);


                    } else if (ConstData.DEVICELIST.equals(showType)) {
                        // 设备巡查中列表

                    } else if (ConstData.MESSAGELIST.equals(showType)) {
                        if (((MessageListAdapter) baseRecyclerAdapter).isChooseDelete()) {
                            if ("1".equals(((MessageListModel) data).getReadFlag())) {
                                ToastUtils.showToast(activity, "未读消息不可删除");
                                return;
                            }
                            ((MessageListModel) data).setSelected(!((MessageListModel) data).isSelected());
                            baseRecyclerAdapter.notifyItemChanged(position);
                        } else {

                            // 消息列表列表点击动作
                            Bundle skipToBundle = new Bundle();
                            skipToBundle.putSerializable("data", data);
                            BannerModel bannerModel = new BannerModel();
                            bannerModel.setActionType(ConstData.SHOWFRAG);
                            bannerModel.setActionValue(ConstData.MESSAGEDETAIL);
                            bannerModel.setActionTitle("消息详情");
                            activity.setClickAction(bannerModel, skipToBundle);
                        }
                    } else if (ConstData.WEIBAOPERSON.equals(showType)) {
                        // 切换选中维保人员
                        WeiBaoPersonModel weiBaoPersonModel = (WeiBaoPersonModel) data;
                        if (((ChooseWeiBaoPersonAdapter) baseRecyclerAdapter).getUserId().equals((weiBaoPersonModel.getUserId()))) {
                            ((ChooseWeiBaoPersonAdapter) baseRecyclerAdapter).setUserId("");
                        } else {
                            ((ChooseWeiBaoPersonAdapter) baseRecyclerAdapter).setUserId(weiBaoPersonModel.getUserId());
                        }
                        baseRecyclerAdapter.notifyDataSetChanged();

                    } else if (ConstData.HOME_BAOJING_DEVICE_LIST.equals(showType)) {

                        // 首页报警设备列表点击动作
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putString("equId", ((SysDeviceModel) data).getEquId());
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.BAOJINGDETAIL);
                        bannerModel.setActionTitle("详情");
                        activity.setClickAction(bannerModel, skipToBundle);

                    } else if (data instanceof XunChaDeviceListModel) {   // 巡查设备列表

                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putString("equId", ((XunChaDeviceListModel) data).getEquId());
                        BannerModel bannerModel = new BannerModel();
                        bannerModel.setActionType(ConstData.SHOWFRAG);
                        bannerModel.setActionValue(ConstData.BAOJINGDETAIL);
                        bannerModel.setActionTitle("详情");
                        activity.setClickAction(bannerModel, skipToBundle);
                    }


                }
            }

        });
    }

    private void initVideoDeviceListHttpHelper(String equVideoIds) {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("id", equVideoIds);

        HashMap<String, String> url_params = new HashMap<>();
        url_params.put(ConstData.JSONOBJECT, JSONUtil.mapToJSonStr(hashMap));
        HttpHelper homeListHttpHelper = new BaoJingListHttpHelper(activity, Url.DEVICE_VIDEO_LIST_URL,
                GET_VIDEO_LIST_WHAT, handler, true, url_params);
        homeListHttpHelper.setParseJsonData(new BaoJingParseJsonData());
        homeListHttpHelper.getHttpRequest(true);
    }
    private class BaoJingListHttpHelper extends HttpHelper {

        public BaoJingListHttpHelper(BaseActivity activity, String url, int what, Handler handler, boolean isPost, HashMap<String, String> params) {
            super(activity, url, what, handler, isPost, params);
        }
    }
    protected class BaoJingParseJsonData extends ParseJsonData {

        public BaoJingParseJsonData() { }
        @Override
        public void analyzeResult(String dataStr, Bundle bundle, int what) {
            try {
                switch (what){

                    case GET_VIDEO_LIST_WHAT:
                        LinkedList<JianKongDeviceModel> jianKongDeviceModels = (LinkedList<JianKongDeviceModel>) JSONUtil.jsonArrayToBeanList(
                                new JSONArray(dataStr), JianKongDeviceModel.class);
                        bundle.putSerializable("list", jianKongDeviceModels);
                        bundle.putBoolean(REQUEST_OK, true);
                        break;
                }
            } catch (Exception e) {
                e.printStackTrace();
                bundle.putBoolean(REQUEST_OK, false);
                bundle.putString(ERROR_MSG, ANALYZE_ERROR_MSG);
            }
        }
    }
    private void initFooterView() {
        footerView = LayoutInflater.from(activity).inflate(R.layout.item_recyclerview_footer, rlv_info_list, false);
        ll_recycler_footer = footerView.findViewById(R.id.ll_recycler_footer);
        ll_recycler_footer.setVisibility(View.GONE);
        rl_no_more_data = footerView.findViewById(R.id.rl_no_more_data);
        rl_no_more_data.setVisibility(View.GONE);
        baseRecyclerAdapter.setFooterView(footerView);
    }

    @Override
    public void onSwipeRefresh() {
        swipe_container.postDelayed(new Runnable() {
            @Override
            public void run() {
                swipe_container.setRefreshing(false);
                updateData();
            }
        }, 2000);
    }

    @Override
    public void onPushDistanceMoreAction(int distance) {

    }

    @Override
    public void onPullEnableMoreAction(boolean enable) {

    }

    @Override
    public void updateData() {
        super.updateData();
        isNoMoreData = false;
        currentPage = 1;
        initHttpHelper();
    }

    private void bottomLoadMore() {
        if (include_no_net.isShown() || include_no_data.isShown()
                || isNoMoreData || !isListLoadOver) {
            return;
        }
        currentPage++;
        setFooterStyle(1);
        initHttpHelper();
    }

    /**
     * 获取列表
     */
    private void initHttpHelper() {
        if (showType.equals(ConstData.JIANKONGDEVICELIST)) {
            if (null != jianKongFloorModel.getChildren() && jianKongFloorModel.getChildren().size() > 0) {
                baseRecyclerAdapter.addDatas(jianKongFloorModel.getChildren());
                include_no_data.setVisibility(View.GONE);
            } else {
                include_no_data.setVisibility(View.VISIBLE);
            }
            isNoMoreData = true;
            return;
        }
        if (showType.equals(ConstData.DEVICEVIDEOLIST)) {
            if (null != jianKongDeviceModels && jianKongDeviceModels.size() > 0) {
                baseRecyclerAdapter.addDatas(jianKongDeviceModels);
                include_no_data.setVisibility(View.GONE);
            } else {
                include_no_data.setVisibility(View.VISIBLE);
            }
            isNoMoreData = true;
            return;
        }
        if (showType.equals(ConstData.XKSVIDEOLIST)) {
            LinkedList<BaseModel> baseModels = new LinkedList<>();
            for (JianKongDeviceModel model : xiaoKongShiModel.getVideos()) {
                baseModels.add(model);
            }
            isNoMoreData = true;
            setListData(baseModels);
            return;
        }
        if (Utils.hasNetwork(activity)) {
            include_no_net.setVisibility(View.GONE);
        } else {
            include_no_net.setVisibility(View.VISIBLE);
            return;
        }
        handler.removeMessages(INFO_LIST_REQUEST_WHAT);
        isListLoadOver = false;
        include_progress_bar.setVisibility(View.VISIBLE);
        HashMap<String, Object> hashMap = setRequestParams();
        HashMap<String, String> url_params = new HashMap<>();

        url_params.put(ConstData.JSONOBJECT, JSONUtil.mapToJSonStr(hashMap));
        HttpHelper homeListHttpHelper = null;
        switch (showType) {
            case ConstData.LOCATIONLIST:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.SYS_BUILD_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.JIANKONGBUILDLIST:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.JIANKONG_BUILDING_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.YUYUE:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.YUYUE_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.YINGHUAN:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.YIHUAN_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.JINGJI:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.JINGJI_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.BAOJING:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.BJ_FUHE_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.UNUSUALLIST:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XKS_RECORD_DETAIL_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.WEIBAOPERSON:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.FIND_WEIBAO_PERSON_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.XUNCHA:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XUNCHA_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.XUNCHAQUESTION:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XUNCHA_QUESTION_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.XUNCHAITEM:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XUNCHA_XUNCHA_ITEM_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.XUNCHADEVICEQUESTION:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XUNCHA_DEVICE_QUESTION_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.DEVICELIST:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XUNCHA_DEVICE_FIND_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.MESSAGELIST:
                homeListHttpHelper = new InfoListListHttpHelper(activity, Url.MESSAGE_LIST_URL,
                        INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                break;
            case ConstData.HOME_BAOJING_DEVICE_LIST:
                if (isHistroyList) {
                    if (isPingBi) {

                        homeListHttpHelper = new InfoListListHttpHelper(activity, Url.DEVICE_PINGBI_HISTORY_URL,
                                INFO_LIST_REQUEST_WHAT, handler, true, url_params);

                    } else {


                        homeListHttpHelper = new InfoListListHttpHelper(activity, Url.DEVICE_HISTORY_URL,
                                INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                    }
                } else {

                        homeListHttpHelper = new InfoListListHttpHelper(activity, Url.HOME_ALARM_URL,
                            INFO_LIST_REQUEST_WHAT, handler, true, url_params);
                }
                break;
            default:
                break;
        }

        if (null != homeListHttpHelper) {
            homeListHttpHelper.setParseJsonData(new InfoListParseJsonData());
            homeListHttpHelper.getHttpRequest(true);
        }
    }

    private HashMap<String, Object> setRequestParams() {
        HashMap<String, Object> url_params = null;
        if (bundle != null && bundle.containsKey(ConstData.ACTIONPARAMS)) {
            url_params = (HashMap<String, Object>) bundle.getSerializable(ConstData.ACTIONPARAMS);
        }
        if (null == url_params) {
            url_params = new HashMap<>();
        }
        try {
            if (null != tv_start_time && ll_calender_select.getVisibility() == View.VISIBLE && isHistroyList) {
                url_params.put("startTime", tv_start_time.getText().toString());
            }
            if (null != tv_stop_time && ll_calender_select.getVisibility() == View.VISIBLE && isHistroyList) {
                url_params.put("endTime", tv_stop_time.getText().toString());
            }
        } catch (Exception e) {
        }
        switch (showType) {
            case ConstData.DEVICELIST:
            case ConstData.WEIBAOPERSON:
            case ConstData.XUNCHAITEM:
            case ConstData.XUNCHAQUESTION:
            case ConstData.LOCATIONLIST:
            case ConstData.JIANKONGBUILDLIST:
            case ConstData.XUNCHADEVICEQUESTION:
                break;
            default:
                url_params.put(ConstData.PAGEINDEX, currentPage + "");
                url_params.put(ConstData.PAGESIZE, ConstData.PAGE_20);
                break;
        }
        switch (showType) {
            case ConstData.BAOJING:
            case ConstData.YINGHUAN:
            case ConstData.UNUSUALLIST:
            case ConstData.MESSAGELIST:
            case ConstData.JINGJI:
            case ConstData.YUYUE:
            case ConstData.HOME_BAOJING_DEVICE_LIST:
            case ConstData.XUNCHA:
            case ConstData.LOCATIONLIST:
                url_params.put(ConstData.COMPANYID, UserInfoModel.getCompandId(activity));
                break;
            default:
                break;
        }
        if (showType.equals(ConstData.YUYUE)) {
            UserInfoModel userInfoModel = UserInfoModel.getUserInfo(activity);
            if (userInfoModel.getRoleAlias().contains(RoleConstant.ROLE_REPAIR_MANAGER)
                    || userInfoModel.getRoleAlias().contains(RoleConstant.ROLE_REPAIR)) {
                url_params.put("repairCompanyId", userInfoModel.getRepairCompanyId());
            }
        } else if (showType.equals(ConstData.WEIBAOPERSON)) {
            url_params.put("id", yuYueModel.getRepairCompanyId());
        } else if (showType.equals(ConstData.UNUSUALLIST)) {
            XksRecordModel xksRecordModel = (XksRecordModel) bundle.getSerializable("data");
            url_params.put("id", xksRecordModel.getId());
        } else if (showType.equals(ConstData.MESSAGELIST)) {
            url_params.put("userId", UserInfoModel.getUserInfo(activity).getId());
        } else if (showType.equals(ConstData.XUNCHAITEM)) {
            url_params.put("id", xunChaPlanModel.getPlanId());
        } else if (showType.equals(ConstData.JIANKONGBUILDLIST)) {
            url_params.put("id", UserInfoModel.getCompandId(activity));
        } else if (showType.equals(ConstData.DEVICELIST) || showType.equals(ConstData.XUNCHADEVICEQUESTION)) {
            url_params.put("floorId", xunChaDeviceFloorModel.getFloorId());
            url_params.put("planId", xunChaDeviceFloorModel.getPlanId());
        }

        return url_params;
    }

    /**
     * 点击已完成
     */
    private void initCompletHttpHelper() {
        if (Utils.hasNetwork(activity)) {
            include_no_net.setVisibility(View.GONE);
        } else {
            include_no_net.setVisibility(View.VISIBLE);
            return;
        }
        include_progress_bar.setVisibility(View.VISIBLE);
        HashMap<String, Object> hashMap = new HashMap<>();
        HttpHelper homeListHttpHelper;
        if (showType.equals(ConstData.DEVICELIST)) {
            StringBuilder stringBuilder = new StringBuilder();
            List<BaseModel> baseModels = baseRecyclerAdapter.getmDatas();
            for (BaseModel model : baseModels) {
                if (model instanceof XunChaDeviceListModel) {
                    XunChaDeviceListModel xunChaDeviceListModel = (XunChaDeviceListModel) model;
                    if (!StringUtils.isEmpty(xunChaDeviceListModel.getFrid())) {
                        continue;
                    }
                    if (StringUtils.isEmpty(stringBuilder.toString())) {
                        stringBuilder.append(xunChaDeviceListModel.getId());
                    } else {
                        stringBuilder.append("," + xunChaDeviceListModel.getId());
                    }
                }
            }
            hashMap.put("id", stringBuilder.toString());
            HashMap<String, String> url_params = new HashMap<>();
            url_params.put(ConstData.JSONOBJECT, JSONUtil.mapToJSonStr(hashMap));
            homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XUNCHA_DEVICE_COMPLETE_URL, COMPLETE_ALL_WHAT, handler, true, url_params);
        } else {
            hashMap.put("id", bundle.getString("ids"));
            HashMap<String, String> url_params = new HashMap<>();
            url_params.put(ConstData.JSONOBJECT, JSONUtil.mapToJSonStr(hashMap));
            homeListHttpHelper = new InfoListListHttpHelper(activity, Url.XUNCHA_COMPLETE_ALL_URL, COMPLETE_ALL_WHAT, handler, true, url_params);
        }
        homeListHttpHelper.setParseJsonData(new InfoListParseJsonData());
        homeListHttpHelper.getHttpRequest(true);
    }

    /**
     * 点击指派维保人员
     */
    private void initPostPersonHttpHelper() {
        if (Utils.hasNetwork(activity)) {
            include_no_net.setVisibility(View.GONE);
        } else {
            include_no_net.setVisibility(View.VISIBLE);
            return;
        }
        include_progress_bar.setVisibility(View.VISIBLE);

        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("id", yuYueModel.getId());
        hashMap.put("userId", ((ChooseWeiBaoPersonAdapter) baseRecyclerAdapter).getUserId());
        HashMap<String, String> url_params = new HashMap<>();
        url_params.put(ConstData.JSONOBJECT, JSONUtil.mapToJSonStr(hashMap));
        HttpHelper postPersonHttpHelper = new InfoListListHttpHelper(activity, Url.POST_WEIBAO_PERSON, POST_PERSON_WHAT, handler, true, url_params);
        postPersonHttpHelper.setParseJsonData(new InfoListParseJsonData());
        postPersonHttpHelper.getHttpRequest(true);
    }

    /**
     * 消息列表长按删除动作
     */
    @Override
    public void deleteMessage() {
        ll_message_bottom.setVisibility(View.VISIBLE);
    }

    private void initMsgDeleteHttpHelper(String msgId) {
        include_progress_bar.setVisibility(View.VISIBLE);
        HashMap<String, Object> url_params = new HashMap<>();
        url_params.put("id", msgId);
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put(ConstData.JSONOBJECT, JSONUtil.mapToJSonStr(url_params));
        InfoListListHttpHelper infoListListHttpHelper = new InfoListListHttpHelper(activity, Url.MESSAGE_DELETE_URL, DELETE_MSG_WHAT, handler, true, hashMap);
        infoListListHttpHelper.setParseJsonData(new InfoListParseJsonData());
        infoListListHttpHelper.getHttpRequest(true);
    }

    private class InfoListListHttpHelper extends HttpHelper {

        public InfoListListHttpHelper(BaseActivity activity, String url, int what, Handler handler, boolean isPost, HashMap<String, String> params) {
            super(activity, url, what, handler, isPost, params);
        }
    }

    protected class InfoListParseJsonData extends ParseJsonData {

        public InfoListParseJsonData() {
        }

        @Override
        public void analyzeResult(String dataStr, Bundle bundle, int what) {
            switch (what) {
                case INFO_LIST_REQUEST_WHAT:
                    try {
                        if (showType.equals(ConstData.DEVICELIST)) {
                            LinkedList<XunChaDeviceListModel> xunChaDeviceListModels = (LinkedList<XunChaDeviceListModel>) JSONUtil.jsonArrayToBeanList(
                                    new JSONArray(dataStr), XunChaDeviceListModel.class);
                            bundle.putSerializable("list", xunChaDeviceListModels);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;

                        } else if (showType.equals(ConstData.UNUSUALLIST)) {
                            XksRecordModel xksRecordModel = JSONUtil.jsonObjectToBean(new JSONObject(dataStr), XksRecordModel.class);
                            LinkedList<XksRecordProblemModel> xksRecordProblemModels = new LinkedList<>();
                            for (XksRecordProblemModel xksRecordProblemModel : xksRecordModel.getRecordProblems()) {
                                xksRecordProblemModels.add(xksRecordProblemModel);
                            }
                            bundle.putSerializable("list", xksRecordProblemModels);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;

                        } else if (showType.equals(ConstData.WEIBAOPERSON)) {
                            LinkedList<WeiBaoPersonModel> weiBaoPersonModels = (LinkedList<WeiBaoPersonModel>) JSONUtil.jsonArrayToBeanList(
                                    new JSONArray(dataStr), WeiBaoPersonModel.class);
                            bundle.putSerializable("list", weiBaoPersonModels);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;

                        } else if (showType.equals(ConstData.XUNCHAITEM)) {
                            LinkedList<XunChaItemModel> xunChaItemModels = (LinkedList<XunChaItemModel>) JSONUtil.jsonArrayToBeanList(
                                    new JSONArray(dataStr), XunChaItemModel.class);
                            bundle.putSerializable("list", xunChaItemModels);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;
                        } else if (showType.equals(ConstData.XUNCHAQUESTION)) {
                            LinkedList<XunChaQuestionModel> xunChaQuestionModels = (LinkedList<XunChaQuestionModel>) JSONUtil.jsonArrayToBeanList(
                                    new JSONArray(dataStr), XunChaQuestionModel.class);
                            bundle.putSerializable("list", xunChaQuestionModels);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;
                        } else if (showType.equals(ConstData.LOCATIONLIST)) {
                            LinkedList<SystemBuildModel> buildModels = (LinkedList<SystemBuildModel>) JSONUtil.jsonArrayToBeanList(
                                    new JSONArray(dataStr), SystemBuildModel.class);
                            bundle.putSerializable("list", buildModels);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;
                        } else if (showType.equals(ConstData.JIANKONGBUILDLIST)) {
                            LinkedList<JianKongBuildingModel> buildModels = (LinkedList<JianKongBuildingModel>) JSONUtil.jsonArrayToBeanList(
                                    new JSONArray(dataStr), JianKongBuildingModel.class);
                            LinkedList<JianKongBuildingModel> models = new LinkedList<>();
                            for (JianKongBuildingModel jianKongBuildingModel : buildModels) {
                                if (jianKongBuildingModel.getDeviceNum() > 0) {
                                    models.add(jianKongBuildingModel);
                                }
                            }
                            bundle.putSerializable("list", models);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;
                        } else if (showType.equals(ConstData.XUNCHADEVICEQUESTION)) {
                            LinkedList<XunChaDeviceQuestionModel> xunChaDeviceQuestionModels = (LinkedList<XunChaDeviceQuestionModel>) JSONUtil.jsonArrayToBeanList(
                                    new JSONArray(dataStr), XunChaDeviceQuestionModel.class);
                            bundle.putSerializable("list", xunChaDeviceQuestionModels);
                            bundle.putBoolean(REQUEST_OK, true);
                            isNoMoreData = true;
                        } else {
                            JSONObject jsonObject = new JSONObject(dataStr);
                            ListModel listModel = JSONUtil.jsonObjectToBean(jsonObject, ListModel.class);
                            if (jsonObject.has("list")) {
                                try {
                                    if (baseRecyclerAdapter.getItemCount() + Integer.parseInt(listModel.getSize())
                                            >= Integer.parseInt(listModel.getTotal())) {
                                        isNoMoreData = true;
                                    }
                                } catch (Exception e) {
                                }
                                switch (showType) {
                                    case ConstData.YUYUE:
                                        LinkedList<YuYueModel> yuYueModels = (LinkedList<YuYueModel>) JSONUtil.jsonArrayToBeanList(
                                                new JSONArray(jsonObject.getString("list")), YuYueModel.class);
                                        bundle.putSerializable("list", yuYueModels);
                                        bundle.putBoolean(REQUEST_OK, true);
                                        break;
                                    case ConstData.JINGJI:
                                        LinkedList<JingJiWeiXiuModel> jingJiWeiXiuModels = (LinkedList<JingJiWeiXiuModel>) JSONUtil.jsonArrayToBeanList(
                                                new JSONArray(jsonObject.getString("list")), JingJiWeiXiuModel.class);
                                        bundle.putSerializable("list", jingJiWeiXiuModels);
                                        bundle.putBoolean(REQUEST_OK, true);
                                        break;
                                    case ConstData.YINGHUAN:
                                        LinkedList<YingHuanModel> yingHuanModels = (LinkedList<YingHuanModel>) JSONUtil.jsonArrayToBeanList(
                                                new JSONArray(jsonObject.getString("list")), YingHuanModel.class);
                                        bundle.putSerializable("list", yingHuanModels);
                                        bundle.putBoolean(REQUEST_OK, true);
                                        break;
                                    case ConstData.BAOJING:
                                        LinkedList<BaoJingCheckModel> baoJingFuHeModels = (LinkedList<BaoJingCheckModel>) JSONUtil.jsonArrayToBeanList(
                                                new JSONArray(jsonObject.getString("list")), BaoJingCheckModel.class);
                                        bundle.putSerializable("list", baoJingFuHeModels);
                                        bundle.putBoolean(REQUEST_OK, true);
                                        break;
                                    case ConstData.XUNCHA:
                                        LinkedList<XunChaPlanModel> xunChaListModels = (LinkedList<XunChaPlanModel>) JSONUtil.jsonArrayToBeanList(
                                                new JSONArray(jsonObject.getString("list")), XunChaPlanModel.class);
                                        bundle.putSerializable("list", xunChaListModels);
                                        bundle.putBoolean(REQUEST_OK, true);
                                        break;

                                    case ConstData.MESSAGELIST:
                                        LinkedList<MessageListModel> messageListModels = (LinkedList<MessageListModel>) JSONUtil.jsonArrayToBeanList(
                                                new JSONArray(jsonObject.getString("list")), MessageListModel.class);
                                        bundle.putSerializable("list", messageListModels);
                                        bundle.putBoolean(REQUEST_OK, true);
                                        break;
                                    case ConstData.HOME_BAOJING_DEVICE_LIST:
                                        mMSysBaoJingDeviceModels = (LinkedList<SysDeviceModel>) JSONUtil.jsonArrayToBeanList(
                                                new JSONArray(jsonObject.getString("list")), SysDeviceModel.class);
                                        bundle.putSerializable("list", mMSysBaoJingDeviceModels);
                                        bundle.putBoolean(REQUEST_OK, true);

                                        break;
                                }
                            }

                        }

                    } catch (Exception e) {
                        e.printStackTrace();
                        bundle.putBoolean(REQUEST_OK, false);
                        bundle.putString(ERROR_MSG, ANALYZE_ERROR_MSG);
                    }
                    break;
                case DELETE_MSG_WHAT:
                    break;
            }
        }
    }

    @Override
    protected void dealWithMyMsgs(Message msg) {
        super.dealWithMyMsgs(msg);
        Bundle bundle = msg.getData();
        if (!bundle.getBoolean(ParseJsonData.REQUEST_OK) ||
                !ParseJsonData.REQUEST_OK_CODE.equals(bundle.getString(ParseJsonData.ERROR_CODE))) {
            if (msg.what == DELETE_MSG_WHAT && ParseJsonData.REQUEST_OK_CODE.equals(bundle.getString(ParseJsonData.ERROR_CODE))) {
                updateData();
                return;
            }
            include_progress_bar.setVisibility(View.GONE);
            if (msg.what == INFO_LIST_REQUEST_WHAT) {
                setFooterStyle(0);
                currentPage--;
                isListLoadOver = true;
            }
            if ((msg.what == COMPLETE_ALL_WHAT || msg.what == POST_PERSON_WHAT) && ParseJsonData.REQUEST_OK_CODE.equals(bundle.getString(ParseJsonData.ERROR_CODE))) {
                PreferencesUtils.putString(activity, ConstData.NEEDREFRESH, "0");
                activity.finish();
            }

            return;
        }
        switch (msg.what) {
            case INFO_LIST_REQUEST_WHAT:
                isListLoadOver = true;
                include_progress_bar.setVisibility(View.GONE);
                setListData((LinkedList<BaseModel>) bundle.getSerializable("list"));
                break;
            case GET_VIDEO_LIST_WHAT:

                LinkedList<JianKongDeviceModel> jianKongDeviceModels = (LinkedList<JianKongDeviceModel>) bundle.getSerializable("list");
                if (null != jianKongDeviceModels && jianKongDeviceModels.size() > 0){
                    if (jianKongDeviceModels.size() == 1){
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putSerializable("JianKongDeviceModel", jianKongDeviceModels.get(0));
                        activity.setClickAction(ConstData.VIDEO, jianKongDeviceModels.get(0).getAccessMode(), "监控设备", null, skipToBundle);
                    }else {
                        Bundle skipToBundle = new Bundle();
                        skipToBundle.putString(ConstData.SHOWTYPPE, ConstData.DEVICEVIDEOLIST);
                        skipToBundle.putSerializable("JianKongDeviceModels", jianKongDeviceModels);
                        activity.setClickAction(ConstData.SHOWFRAG, ConstData.INFOLIST, "监控设备", null, skipToBundle);
                    }
                }
                break;
        }
    }

    private void setListData(LinkedList<BaseModel> list) {
        if (null == list || list.size() == 0) {
            if (currentPage == 1) {
                if (ConstData.WEIBAOPERSON.equals(showType)) {
                    bt_add_unusual.setVisibility(View.GONE);
                }
                baseRecyclerAdapter.clear();
                include_no_data.setVisibility(View.VISIBLE);
            } else {
                setFooterStyle(2);
            }
            return;
        }
        if (ConstData.WEIBAOPERSON.equals(showType)) {
            bt_add_unusual.setVisibility(View.VISIBLE);
        }
        include_no_data.setVisibility(View.GONE);
        setFooterStyle(0);
        if (currentPage == 1) {
            baseRecyclerAdapter.clear();
        }
        baseRecyclerAdapter.addDatas(list);

    }

    /**
     * 0不显示 1正在加载中 2无更多数据
     *
     * @param style
     */
    private void setFooterStyle(int style) {
        switch (style) {
            case 1:
                footerView.setVisibility(View.VISIBLE);
                ll_recycler_footer.setVisibility(View.VISIBLE);
                rl_no_more_data.setVisibility(View.GONE);
                break;
            case 2:
                footerView.setVisibility(View.VISIBLE);
                ll_recycler_footer.setVisibility(View.GONE);
                rl_no_more_data.setVisibility(View.VISIBLE);
                isNoMoreData = true;
                break;
            default:
                footerView.setVisibility(View.GONE);
                break;
        }
    }


    private void initStartTimePicker() {//Dialog 模式下，在底部弹出
        pvStartTime = new TimePickerBuilder(activity, new OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date, View v) {
                // Toast.makeText(MainActivity.this, getTime(date), Toast.LENGTH_SHORT).show();
                //Log.i("pvTime", "onTimeSelect");
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD_HH_MM_SS);
                tv_start_time.setText(simpleDateFormat.format(date));
                currentPage = 1;
                isNoMoreData = false;
                initHttpHelper();
            }
        })
                .setTimeSelectChangeListener(new OnTimeSelectChangeListener() {
                    @Override
                    public void onTimeSelectChanged(Date date) {
                        // Log.i("pvTime", "onTimeSelectChanged");
                    }
                })
                .setType(new boolean[]{true, true, true, true, true, true})
                .isDialog(true) //默认设置false ，内部实现将DecorView 作为它的父控件。
                .addOnCancelClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        //  Log.i("pvTime", "onCancelClickListener");
                    }
                })
                .setItemVisibleCount(5) //若设置偶数，实际值会加1（比如设置6，则最大可见条目为7）
                .setLineSpacingMultiplier(2.0f)
                .isAlphaGradient(true)
                .build();

        Dialog mDialog = pvStartTime.getDialog();
        if (mDialog != null) {

            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT,
                    Gravity.BOTTOM);

            params.leftMargin = 0;
            params.rightMargin = 0;
            pvStartTime.getDialogContainerLayout().setLayoutParams(params);

            Window dialogWindow = mDialog.getWindow();
            if (dialogWindow != null) {
                dialogWindow.setWindowAnimations(com.bigkoo.pickerview.R.style.picker_view_slide_anim);//修改动画样式
                dialogWindow.setGravity(Gravity.BOTTOM);//改成Bottom,底部显示
                dialogWindow.setDimAmount(0.3f);
            }
        }
    }

    private void initStopTimePicker() {//Dialog 模式下，在底部弹出
        pvStopTime = new TimePickerBuilder(activity, new OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date, View v) {
                // Toast.makeText(MainActivity.this, getTime(date), Toast.LENGTH_SHORT).show();
                Log.i("pvTime", "onTimeSelect");
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD_HH_MM_SS);
                tv_stop_time.setText(simpleDateFormat.format(date));
                currentPage = 1;
                isNoMoreData = false;
                initHttpHelper();
            }
        })
                .setTimeSelectChangeListener(new OnTimeSelectChangeListener() {
                    @Override
                    public void onTimeSelectChanged(Date date) {
                        Log.i("pvTime", "onTimeSelectChanged");
                    }
                })
                .setType(new boolean[]{true, true, true, true, true, true})
                .isDialog(true) //默认设置false ，内部实现将DecorView 作为它的父控件。
                .addOnCancelClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        //  Log.i("pvTime", "onCancelClickListener");
                    }
                })
                .setItemVisibleCount(5) //若设置偶数，实际值会加1（比如设置6，则最大可见条目为7）
                .setLineSpacingMultiplier(2.0f)
                .isAlphaGradient(true)
                .build();

        Dialog mDialog = pvStopTime.getDialog();
        if (mDialog != null) {

            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT,
                    Gravity.BOTTOM);

            params.leftMargin = 0;
            params.rightMargin = 0;
            pvStopTime.getDialogContainerLayout().setLayoutParams(params);

            Window dialogWindow = mDialog.getWindow();
            if (dialogWindow != null) {
                dialogWindow.setWindowAnimations(com.bigkoo.pickerview.R.style.picker_view_slide_anim);//修改动画样式
                dialogWindow.setGravity(Gravity.BOTTOM);//改成Bottom,底部显示
                dialogWindow.setDimAmount(0.3f);
            }
        }
    }

    /**
     * 跳转到nfc巡检
     */
    public void skipToNfcPage() {
        Bundle skipBundle = new Bundle();
        if (null != bundle) {
            skipBundle.putSerializable(ConstData.ACTIONPARAMS, bundle.getSerializable(ConstData.ACTIONPARAMS));
        }
        activity.openActivity(NfcDeviceActivity.class, skipBundle, 0);
    }


    @Override
    public void onResume() {
        super.onResume();
        if (ConstData.MESSAGELIST.equals(showType) && !isFirstLoad) {
            updateData();
        }
        isFirstLoad = false;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
  /*      if(EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().unregister(this);
        }*/
        if (null != pvStartTime) {
            pvStartTime.dismiss();
        }
        if (null != pvStopTime) {
            pvStopTime.dismiss();
        }
        DialogUtils.closeDialog(completeAllDialog);
        DialogUtils.closeDialog(msgDeleDialog);
        DialogUtils.closeDialog(openNfcDialog);
    }

}
